<html>
<head><meta charset="utf-8"><title>Generating docs without source code · rustdoc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/index.html">rustdoc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html">Generating docs without source code</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="226936755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/226936755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#226936755">(Feb 19 2021 at 09:07)</a>:</h4>
<p>Hello, i was talking today with other people about shipping pre-built rlibs. One thing that come to us is that docs is needed so people can read and understand how to use the library. However rustdoc seems to include the original source code as webpages. I wonder if there's already an option to turn that off. Thanks!</p>



<a name="226952529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/226952529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#226952529">(Feb 19 2021 at 11:47)</a>:</h4>
<p><a href="https://doc.rust-lang.org/rustdoc/the-doc-attribute.html#html_no_source">https://doc.rust-lang.org/rustdoc/the-doc-attribute.html#html_no_source</a></p>



<a name="226984250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/226984250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#226984250">(Feb 19 2021 at 16:01)</a>:</h4>
<p>is there a way we could document this better? I see this question a lot</p>



<a name="226997344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/226997344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#226997344">(Feb 19 2021 at 17:22)</a>:</h4>
<p>I personally found that by doing:</p>
<div class="codehilite"><pre><span></span><code>cd src/librustdoc
rg &#39;src&#39;
bat html/sources.rs
rg -C3 &#39;include_sources&#39;
</code></pre></div>
<p>Which lead me to <code>html_no_source</code> and from there I got to <a href="https://doc.rust-lang.org/rustdoc">https://doc.rust-lang.org/rustdoc</a>; only then did it occur to me that I could have started by looking there directly <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>



<a name="226997894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/226997894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#226997894">(Feb 19 2021 at 17:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code/near/226984250">said</a>:</p>
<blockquote>
<p>is there a way we could document this better? I see this question a lot</p>
</blockquote>
<p>I'd say that some command line flag within the <code>rustdoc</code> CLI utility may be where people will be looking for this kind of thing first.<br>
Maybe having a FAQ version of <a href="https://doc.rust-lang.org/rustdoc/">https://doc.rust-lang.org/rustdoc/</a> or just rephrasing it so that it's better referenced within search indices can suffice <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="226998708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/226998708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#226998708">(Feb 19 2021 at 17:32)</a>:</h4>
<p>We should probably just merge <a href="https://github.com/rust-lang/rust/pull/75522">https://github.com/rust-lang/rust/pull/75522</a> then</p>



<a name="227001887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/227001887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#227001887">(Feb 19 2021 at 17:54)</a>:</h4>
<p>There is always <code>RUSTDOCFLAGS='-Zcrate-attr=doc(html_no_source)' cargo +nightly doc</code> <span aria-label="smiling devil" class="emoji emoji-1f608" role="img" title="smiling devil">:smiling_devil:</span></p>



<a name="227001966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/227001966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#227001966">(Feb 19 2021 at 17:55)</a>:</h4>
<p>I didn't know that was a thing!</p>



<a name="227002172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/227002172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#227002172">(Feb 19 2021 at 17:56)</a>:</h4>
<p>I've sometimes used <code>-Zcrate-attr=feature(backtrace)</code> so as to be able to use <code>::std::backtrace</code> in the middle of random code when debugging <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="227009525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/227009525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#227009525">(Feb 19 2021 at 18:51)</a>:</h4>
<p>If we want to merge <a href="https://github.com/rust-lang/rust/pull/75522">https://github.com/rust-lang/rust/pull/75522</a>, please tell me so I update it</p>



<a name="227031227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/227031227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#227031227">(Feb 19 2021 at 21:28)</a>:</h4>
<p>In general, I think the Rustdoc Book is not well-known enough. I didn't realize it existed until after I started contributing to rustdoc <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="227032851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/227032851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#227032851">(Feb 19 2021 at 21:43)</a>:</h4>
<p>That's a common issue for most tools actually. I really don't know how we could improve that situation... Showing that in the rustdoc error/warning messages at the end maybe?</p>



<a name="227033079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/227033079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#227033079">(Feb 19 2021 at 21:44)</a>:</h4>
<p>No, that seems like it would be annoying.</p>



<a name="227033126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/Generating%20docs%20without%20source%20code/near/227033126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/Generating.20docs.20without.20source.20code.html#227033126">(Feb 19 2021 at 21:45)</a>:</h4>
<p>But yeah, I doubt many people read much of the Cargo and rustc books.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>